import { Component, OnInit, ViewChild, Input } from '@angular/core';
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
import { DataService } from '../../../services/data.service';
@Component({
  selector: 'app-detail',
  templateUrl: './detail.component.html',
  styleUrls: ['./detail.component.scss']
})
export class OnetomanyDetailComponent implements OnInit {
  public list = [];

  public type = "a";

  public operate:any;

  public iswhat = sessionStorage.getItem('otm_isStop');

  public selectLabel = "1-1";

  public tempSelectLabel = "1-1";

  public step = 2;

  public labelName = "";

  public currentStatus = true;

  public isNew = this.dataService.data;


  constructor(
    private route: ActivatedRoute,
    private dataService: DataService//构造dataService
  ) {

  }

  showHisListModal() {
    window['$']("#detail-his-list-modal").modal();
  }
  ngOnInit() {


    // 获取路由中operate字段，决定是否显示步骤条,operate=='edit'显示，'new'隐藏
    this.route.params.subscribe((data: any) => {
      let that = this;
      this.operate = data.operate;
    });


  }
  ngAfterViewInit() {
    // 指定单列不排序
    window['$']('.datatable-control-custom-4').DataTable({
      "paging": false,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": false,
      "autoWidth": false,
      "columnDefs":[
        { 
          //"searchable": false,
          "orderable": false, 
          "targets": 4
        }
      ]
    });
  }
}

